<html>
<head><meta charset="utf-8"><title>type-relative paths in lowering · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html">type-relative paths in lowering</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="163770573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163770573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163770573">(Apr 19 2019 at 22:24)</a>:</h4>
<p>Does anyone familiar with the resolver know why <code>expr_std_path</code> can't resolve type-relative paths? I get an error when trying to use it with <code>std::pin::Pin::new_unchecked</code> (works fine with e.g. <code>std::ops::Try::into_result</code>, but that's an associated method of a trait, not a type)</p>



<a name="163770653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163770653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163770653">(Apr 19 2019 at 22:25)</a>:</h4>
<p>Is this limitation fundamental? My temporary workaround plan is  to introduce an unstable feature-gated fn <code>std::pin::new_unchecked</code> and call that instead, but I'd prefer to avoid introducing hacks if unnecessary.</p>



<a name="163942919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163942919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163942919">(Apr 22 2019 at 22:05)</a>:</h4>
<p>ping-- anyone know about this? maybe <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> ?</p>



<a name="163945996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163945996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163945996">(Apr 22 2019 at 22:55)</a>:</h4>
<p><code>expr_std_path</code> is a module-relative resolution thing.<br>
It's too early to resolve type-relative paths at that point.</p>



<a name="163946071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163946071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163946071">(Apr 22 2019 at 22:56)</a>:</h4>
<p>You can actually make a partially resolved path during lowering and put it into HIR.</p>



<a name="163946078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163946078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163946078">(Apr 22 2019 at 22:56)</a>:</h4>
<p>And it will be resolved during type checking.</p>



<a name="163946173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163946173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163946173">(Apr 22 2019 at 22:58)</a>:</h4>
<p><code>std::pin::Pin</code> can be fed to <code>std_path</code>, then the last segment added as <code>hir::QPath::TypeRelative</code></p>



<a name="163946209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163946209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163946209">(Apr 22 2019 at 22:59)</a>:</h4>
<p>Actually, <code>ExprKind::Range</code> desugaring works that way already.</p>



<a name="163946321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/type-relative%20paths%20in%20lowering/near/163946321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/type-relative.20paths.20in.20lowering.html#163946321">(Apr 22 2019 at 23:00)</a>:</h4>
<p>(To clarify, <code>std::ops::Try::into_result</code> is module-relative because traits and enums are modules in the eyes of name resolution.)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>